;[INSTALL]
; $tar zxvf org-7.4.tar.gz 
; $mv org-7.4/ ~/.emacs.d/
; $cd ~/.emacs.d/org-7.4/
; $make
;[BASIC SETUP]
(setq load-path (cons "~/.emacs.d/org-7.4/lisp" load-path))
(setq load-path (cons "~/.emacs.d/org-7.4/contrib/lisp" load-path))
(require 'org-install)
(require 'org-publish)
;(global-set-key (kbd "<f8> p") 'org-publish)
; The following lines are always needed. Choose your own keys.
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
					; not needed when global-font-lock-mode is on
(add-hook 'org-mode-hook 'turn-on-font-lock (lambda () (setq truncate-lines nil)) ) 
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-agenda-files (list "/home/lemacs/Public/my_sources/org_workspace/orgs/todos/study.org"
			     "/home/lemacs/Public/my_sources/org_workspace/orgs/todos/course.org"))


;; turn on org-indent-mode(minor mode),all lines are prefixed for display 
;; with the necessary amount of space.
;(setq org-startup-indented t)
;; hiding all leading stars
(setq org-hide-leading-stars t)
;[STYLE]
; Use org_**.css from local for export document stylesheets
(setq org-export-html-style-extra "<link rel=\"stylesheet\" 
      href=\"/home/lemacs/Desktop/org_workspace/org_html_style_norang.css\" type=\"text/css\" />")
(setq org-export-html-style-include-default nil)
; Do not generate internal css formatting for HTML exports
(setq org-export-htmlize-output-type (quote css))
; Inline images in HTML instead of producting links to the image
(setq org-export-html-inline-images t)
;[EXPORT]
; Disabling Underscore subscript in Emacs Tex Mode
(setq org-export-with-sub-superscripts nil)
;[PUBLISH]
(setq org-publish-project-alist
      '(("note-org"
         :base-directory "/home/lemacs/Public/my_sources/org_workspace/orgs/"
         :publishing-directory "/home/lemacs/Public/my_sources/org_workspace/htmls"
         :base-extension "org"
	 :style-include-default nil
         :recursive t
	 :auto-sitemap t
	 :sitemap-title "Lemacs's notes"
	 :sitemap-filename "index.org"
	 :sitemap-alphabetically t
					;:link-up "index.html"
					;:link-home "index.html"
	 :style-extra "<link rel=\"stylesheet\" href=\"../style/org_html_style_norang.css\" type=\"text/css\"/>"
         :publishing-function org-publish-org-to-html)
	("note-extra"
         :base-directory "/home/lemacs/Public/my_sources/org_workspace/orgs/"
         :publishing-directory "/home/lemacs/Public/my_sources/org_workspace/htmls"
         :recursive t
         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|swf\\|zip\\|gz\\|txt\\|el"
         :publishing-function org-publish-attachment
	 :author nil)
        ("org" 
         :components ("note-org")
         :author "gan_xiangle"
	 :email-info "ganxiangle@gmail.com"
         ))
      )
;[KEY]
; It's bound to C-S-F12 so I just edit and hit C-S-F12 when I'm done and move on to the next thing
(defun bh/save-then-publish ()
  (interactive)
  (save-buffer)
  (org-save-all-org-buffers)
  (org-publish-all))
(global-set-key (kbd "C-<f12>") 'bh/save-then-publish)
;[DITAA IN ORG]
(setq org-ditaa-jar-path "~/Software/ditaa0_9/ditaa0_9.jar")
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
(setq org-babel-load-languages (quote ((emacs-lisp . t)
				       (dot . t)
				       (ditaa . t)
				       (R . t)
				       (python . t)
				       (ruby . t)
				       (gnuplot . t)
				       (clojure . t)
				       (sh . t))))

(setq org-confirm-babel-evaluate nil)

